-
Notifications
You must be signed in to change notification settings - Fork 1.1k
syntax.md: support multiple if-guards on same line #11215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
To evaluate this, I would like to understand how the Scala 3 spec came to differ from the Scala 2 spec on this point. Who did that when, and why? Was it done on purpose, or could be accidental fallout from some sort of refactoring? |
The Scala-2 syntax reads
I believe the intention was that the optional semicolon before a @unkarjedy Can you make the change here, and also in
The three syntaxes should be kept in sync. |
Consider the example: ```scala for { x <- 1 to 5 if true; if true; if true } yield x ``` Note, that multiple if guards start from a new line and are not separated with a semicolon or a new line. This code is compiled ok in Scala 3 and is a valid code according to Scala 2 syntax reference: (though looks like there is a bug in implementation scala/bug#12323) But it's not supported according to the Scala 3 syntax reference. related issues: scala/bug#12323 https://youtrack.jetbrains.com/issue/SCL-13220
updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good, thank you, however the AST nodes should only appear in the internals reference
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
Merged the changes As I understand there is an option to "Squash and Merge" directly in Github, so do I need to manually squash the commits? |
@bishabosha What's the status of this PR? Can we merge it? |
Consider the example:
Note, that multiple if guards start from a new line and are not separated with a semicolon or a new line.
This code is compiled ok in Scala 3 and is a valid code according to Scala 2 syntax reference:
(though looks like there is a bug in implementation scala/bug#12323)
But it's not supported according to the Scala 3 syntax reference.
related issues:
scala/bug#12323
https://youtrack.jetbrains.com/issue/SCL-13220